//Score.prototype = new Sprite();

function Score (){
    //  Sprite.apply(this);
    this.infScore = 0;
    this.physScore = 0;
    this.mathScore = 0;
    this.maxPossibleScore = 135;
    this.scoreLossPerSec = 0.2;
    this.addScore = addScore;
    this.restart = restart;
    
    function addScore (requiredTime,realTime,levelType){
        var score = 0;
        if (realTime-requiredTime <= 0)
            score = 10;
        else{
            score = 10-(realTime-requiredTime)*this.scoreLossPerSec;
            if (score < 0)
                score = 0;
        }

        switch (levelType){
            case typeMath:
                this.mathScore += score;
                break;
            case typePhys:
                this.physScore += score;
                break;
            case typeInf:
                this.infScore += score;
                break;
        }
    }

    function restart(){
        this.infScore = 0;
        this.physScore = 0;
        this.mathScore = 0;
    
    
    }
}

